#include "stdafx.h"
#include "wf_blocksedit.h"

#include "pf_graphic.h"
#include "pf_dialogfactory.h"



WF_BlocksEdit::WF_BlocksEdit(PF_Container& container,
        PF_GraphicView& graphicView)
        :PF_ActionInterface("Edit Block", container, graphicView) {}


QAction* WF_BlocksEdit::createGUIAction(LX_Define::ActionType /*type*/, QObject* /*parent*/) {
	//  tr("&Edit Block")
	QAction* action = new QAction( tr("&Edit Block"), NULL);
    //action->zetStatusTip(tr("Edit Block"));
	action->setIcon(QIcon(":/ui/blockedit.png"));
	return action;
}


void WF_BlocksEdit::trigger() {
    PF_DEBUG->print("edit block");
    if (graphic!=NULL) {
        if (PF_DIALOGFACTORY!=NULL) {
            PF_DIALOGFACTORY->requestEditBlockWindow(graphic->getBlockList());
        }
    } else {
        PF_DEBUG->print(PF_Debug::D_WARNING,
        	"WF_BlocksEdit::trigger(): graphic is NULL");
    }
    finish();
}



void WF_BlocksEdit::init(int status) {
    PF_ActionInterface::init(status);
    trigger();
}

